﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace TecentCOS.webapi.Controllers
{
    public class BaseController : ApiController
    {
        public class ResponseModel
        {
            public int code { get; set; }

            public bool success { get; set; }
            public string message { get; set; }
            public object data { get; set; }
        }

        public ResponseModel Success(object data,string message="请求成功")
        {
            return new ResponseModel()
            {
                code = 200,
                success = true,
                message = message,
                data = data
            };
        }
        public ResponseModel Fail(object data, string message = "请求失败")
        {
            return new ResponseModel()
            {
                code = 400,
                success = false,
                message = message,
                data = data
            };
        }

    }

}
